COMPILE_TYPE=""

BUILD_COMAPK_ERROR="Error occurs while building apk, build process will stop and exit"

echo ============ BUILD START =============
#Choose compile type
if [ $1 = 'debug' ] ; then
	COMPILE_TYPE='debug'
elif [ $1 = 'release' ] ; then
	COMPILE_TYPE='release'
else
	echo "Invalid compile type, please choose either debug or release"
	exit 1
fi

#Build android apk base on compile type
if [ $COMPILE_TYPE = 'release' ] ; then
	echo "compile carpool component begins"
	echo `pwd`
	ls -al
	cd ./carpool
	chmod +x build_ubuntu_com.sh 
	sh build_ubuntu_com.sh release
	if [ $? != 0 ] ; then
	echo $BUILD_COMAPK_ERROR
	exit 1
	fi
else
	echo "compile type not supported yet"
	exit 1
fi
